package ServerApp;

import java.io.Serializable;
import java.security.acl.Permission;

import ServerApp.Server.TimeOut;

// test

public class User implements Serializable{

	private String name;
	private String password;
	private Boolean permission;
	
	public User(){
	}
	
	public User(String name, String password, Boolean permission){
	
		this.name = name;
		this.password = password;
		this.permission = permission;
	
	}
	
	public String getName(){
		return name;		
	}
	
	public void setName(String name){
		this.name = name;
	}
	
	public String getPassword(){
		return password;
	}
	
	public void setPassword(String password){
		this.password = password;
	}
	
	public Boolean getPermission(){
		return permission;
	}
	
	public void setPermission(Boolean permission){
		this.permission = permission;
	}

	@Override
	public String toString() {
		return "Name: " + name + ", password: " + password + ", permission: " + permission.toString();
	}
	
	@Override
	public boolean equals(Object obj) {
		User u = null;
		if(obj instanceof TimeOut)
			u = ((TimeOut) obj).user;
		else
			u = (User) obj;
		if(name.equals(u.name) && password.equals(u.password))
			return true;
		else return false;
	}
	
	public boolean verifyCredentials(String username, String password){
		return this.name.equals(username) && this.password.equals(password);
	}
}
